<?php
/**
 * Created by PhpStorm.
 * User: sosyuki
 * Date: 2018-12-07
 * Time: 15:04
 */

namespace Drupal\points\Entity;


use Entity;

class PointsType extends Entity {

  public $type;

  public $label;

  public $weight = 0;

  public $description;

  public function __construct($values = [], $entityType = NULL) {
    parent::__construct($values, 'points_type');
  }

  /**
   * Returns whether the wechat_request_message type is locked, thus may not be
   * deleted or renamed.
   *
   * Wechat_request_message types provided in code are automatically treated as
   * locked, as well as any fixed wechat_request_message type.
   */
  public function isLocked() {
    return isset($this->status) && empty($this->is_new) && (($this->status & ENTITY_IN_CODE) || ($this->status & ENTITY_FIXED));
  }


  /**
   * Overrides Entity::save().
   */
  public function save() {
    parent::save();
    // Clear field info caches such that any changes to extra fields get
    // reflected.
    field_info_cache_clear();
  }
}
